"""A Google App Engine blog application.
"""

__author__ = 'Watson'

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from blog.view import HomePage
from blog.view import PostPage
from blog.view import ListPostPage
from blog.view import NewPostPage
from blog.view import EditPostPage
from blog.view import InvalidPage
from blog.view import UploadPicPage
from blog.view import PicPage
from blog.sessions import SessionHandler
import logging


def main():
  logging.getLogger().setLevel(logging.DEBUG)
  application = webapp.WSGIApplication(
                                       [
                                        (r'/$',HomePage),
                                        (r'/home$', HomePage),
                                        (r'/post/new.html', NewPostPage),                                        
                                        (r'/post/edit_(.*)\.html', EditPostPage),
                                        (r'/post/(.*)\.html', PostPage),
                                        (r'/post/?$', ListPostPage),
                                        (r'/pic/upload.html', UploadPicPage),
                                        (r'/pic/(.*)\.html', PicPage),
                                        (r'.*', InvalidPage)
                                       ],
                                       debug=True
                                      )
  run_wsgi_app(application)


if __name__ == '__main__':
  main()
